text: React to text attribute changes in css
authorMatthias Clasen <mclasen@redhat.com>
Wed, 21 Oct 2020 17:46:58 +0000 (13:46 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 21 Oct 2020 17:46:58 +0000 (13:46 -0400)
Recompute the layout when the css style change
affects text attributes. This matches what we do
in GtkLabel, and without this, changing the
font-features-setting css property in the Inspector
does not have immediate effect.

gtk/gtktext.c

index 7f3d064a941e6928d08ec76ab579b8ee898477c5..8f2745caf61f952af16dad4b360df911235a0f72 100644 (file)
@@ -3488,11 +3488,13 @@ gtk_text_css_changed (GtkWidget         *widget,
 
   gtk_text_update_cached_style_values (self);
 
-  if (change == NULL ||
-      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
+  if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
                                             GTK_CSS_AFFECTS_BACKGROUND |
                                             GTK_CSS_AFFECTS_CONTENT))
-    gtk_widget_queue_draw (GTK_WIDGET (self));
+    gtk_widget_queue_draw (widget);
+
+  if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS))
+    gtk_text_recompute (self);
 }
 
 static void